/*
 * Edge.h
 *
 *  Created on: 25/01/2012
 *      Author: paula
 */

#ifndef EDGE_H_
#define EDGE_H_
#include "PointTable.h"
/*
 * Represents an weighted edge composed by
 * an iterator for its first point (pt1)
 * an iterator for its second point (pt2)
 * an weight
 *
 * Points are stored in a PointTable struct
 */

class Edge {
public:
	PointTable::iterator pt1;
	PointTable::iterator pt2;
	float w;

	Edge();
	virtual ~Edge();

	//Constructs an edge
	Edge(PointTable::iterator it1, PointTable::iterator it2, float wt);

	/*
	 * overload operator <
	 * An Edge is smaller than other edge, when its first point is the smallest.
	 * Or when its first point is equal to first point of other,  its second point is the smallest.
	 */
	inline bool operator< (const Edge& other) const {
			return ((*pt1 < *(other.pt1))||((*pt1 == *(other.pt1))&&(*pt2 < *(other.pt2))));
		}
};

#endif /* EDGE_H_ */



